﻿using Guru.ErrorHandling.Source.DL;
using Guru.Framework.Base;
using System;

namespace Guru.ErrorHandling.Source.BO
{
    public class Log : AbstractBaseBO
    {
        private int _OBJID;
        private string _Message;
        private string _StackTrace;
        private string _Title;
        private int _ErrorCode;
        private int _UserId;
        private int _AppType;
        private DateTime _LogTime;

        public int OBJID
        {
            set { _OBJID = value; AddChangeList("OBJID"); }
            get { return _OBJID; }
        }
        public string Message
        {
            set { _Message = value; AddChangeList("Message"); }
            get { return _Message; }
        }
        public string StackTrace
        {
            set { _StackTrace = value; AddChangeList("StackTrace"); }
            get { return _StackTrace; }
        }
        public string Title
        {
            set { _Title = value; AddChangeList("Title"); }
            get { return _Title; }
        }
        public int ErrorCode
        {
            set { _ErrorCode = value; AddChangeList("ErrorCode"); }
            get { return _ErrorCode; }
        }
        public int UserId
        {
            set { _UserId = value; AddChangeList("UserId"); }
            get { return _UserId; }
        }
        public DateTime LogTime
        {
            set { _LogTime = value; AddChangeList("LogTime"); }
            get { return _LogTime; }
        }
        public int AppType
        {
            set { _AppType = value; AddChangeList("AppType"); }
            get { return _AppType; }
        }

        public override string GetTable()
        {
            return "LogEntry";
        }
        public override string GetIdColumn()
        {
            return "OBJID";
        }

        public Log()
        {
            LogTime = DateTime.Now;
            AppType = 0;
        }

        public int Insert()
        {
            try
            {
                return (new LogDL()).Insert(this);
            }
            catch (Exception)
            {
                throw;
            }
        }


        public int Delete()
        {
            return -1;
        }

        public int InsertAndGetId()
        {
            return -1;
        }

        public int Update()
        {
            return -1;
        }
    }
}
